<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <!-- <fieldset id="aa"> -->

    <input type="checkbox" id="bb">全选
    <!-- <button id="sh">uosauf</button> -->

    <br>

    <input type="checkbox" class="cc" />第一个

    <br>

    <input type="checkbox" class="cc" />第二个

    <br>

    <input type="checkbox" class="cc" />第三个

    <br>

    <input type="checkbox" class="cc" />第四个

    <br>

    <input type="checkbox" class="cc" />第五个

    <br>

    <input type="checkbox" class="cc" />第六个

    <br>

    <input type="checkbox" class="cc" />第七个

    <br>

    <!-- </fieldset> -->

</body>
<script>

    window.onload = function () {
        bb.onclick = function () {
            var bb1 = document.getElementById('bb');
            var cc1 = document.getElementsByClassName('cc');

            for (var i = 0; i < cc1.length; i++) {
                if (bb1.checked == false) {
                    cc1[i].checked = false;
                }else{
                    cc1[i].checked = true;
                }


            }



        }

    }



</script>

</html>